package com.ehcache.ehcache;

import java.util.stream.IntStream;

public class Test {
	private static int x=100;
	public static void main(String args[]){

		IntStream.range(0,2).forEach(i->{

			new  Thread(() -> {
				synchronized (Test.class){
					System.out.println("线程名称"+Thread.currentThread().getName());
					Test hs1=new Test();
					hs1.x++;
					System.out.println("x="+x);
					test();
				}

			}).start();

		});
		try {
			Thread.sleep(1000);
			System.out.println("sssssssssssss"+x);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

	}
	public static void test(){
		System.out.println("----------"+x);
	}
}
